package com.aimei520.utils;

public class NavListUtils {
	
	public static StringBuffer getNavList(String nowUrl,int nowPageNum,int[] navigatepageNums, boolean isFirstPage, boolean isLastPage) {
		
		StringBuffer result = new StringBuffer();
		
		result.append("<a class=\"prev"+ (isFirstPage ? " navPage-UnClick" : "") +"\" href=\"" + ( isFirstPage ? "#" : nowUrl+"?pageNum="+( nowPageNum - 1 ) )+"\">&lt;&lt;</a>");
		
		for (int i = 0; i <navigatepageNums.length; i++) {
			if(navigatepageNums[i] == nowPageNum)
				result.append(" <span class=\"current\" href=\""+ nowUrl +"?pageNum="+navigatepageNums[i]+"\">"+navigatepageNums[i]+"</span>");
			else
				result.append(" <a class=\"num\" href=\""+ nowUrl +"?pageNum="+navigatepageNums[i]+"\">"+navigatepageNums[i]+"</a>");
		}
		
		result.append("<a class=\"prev"+ (isLastPage ? " navPage-UnClick" : "") +"\" href=\"" + ( isLastPage ? "#" : nowUrl+"?pageNum="+( nowPageNum + 1 ) )+"\">&gt;&gt;</a>");
		
		return result;
	}
	
}
